<template>
	<view style="height: 1246rpx;background-color: #F7F7F7;">
		<view style="padding-top: 60rpx;">
			<view style="width: 710rpx;height: 480rpx;background-color: #fff;border-radius: 20rpx;margin: 0 20rpx;padding-top: 20rpx;">
				<view class="gl">
					<text>姓名:</text>
					<input type="text" v-model="name" placeholder="请输入姓名" />
				</view>
				<view class="gl">
					<text>昵称:</text>
					<input type="text" v-model="nickName" placeholder="请输入昵称" />
				</view>
				<view class="gl">
					<text>电话:</text>
					<input type="text" v-model="phone" placeholder="请输入电话" />
				</view>
				
				<view class="gl">
					<text>性别:</text>
					<input type="text" v-model="sex" placeholder="请输入性别" />
				</view>
				<view class="gl">
					<text>年龄:</text>
					<input type="text" v-model="age" placeholder="请输入年龄" />
				</view>
				
				
			</view>
			<button type="default" @click="add" style="width: 710rpx;height: 92rpx;background-color: #FEB140;border-radius: 20rpx;color: #fff;font-size: 32rpx;font-weight: bold;margin-top: 150rpx;">确认添加</button>
		</view>
	</view>
</template>

<script>
	import {
		Storage
	} from "@/static/libs/utils";
	export default {
		data() {
			return {
				name:'',
				phone:'',
				token:'',
				id:'',
				sex:'',
				nickName:'',
				age:''
				
			};
		},
		onLoad() {
			this.token = Storage.get('token');
			this.id = Storage.get('id');
		},
		methods:{
			add(){
				this.$request.post(`/waimai_go/app/index.php?i=1&c=entry&ctrl=delivery&ac=auth&op=register&do=mobile&m=we7_wmall&token=${this.token}&isajax=1`,
				{
					title:this.name,
					mobile:this.phone,
					nickname:this.nickName,
					sex:this.sex,
					age:this.age
				}).then(res =>{
					// console.log(res);
					// this.dispatchers = res.data.data
					if(res.data.message.errno==0){
						this.$request.post(`/waimai_go/web/wmerchant.php?c=site&a=entry&ctrl=store&ac=shop&op=deliveryer&ta=add&do=web&m=we7_wmall&i=1&token=${this.token}&isajax=1`,{mobile:this.phone})
						.then(res=>{
							if(res.data.message.errno==0){
								uni.showToast({
									title:res.data.message.message,
									icon:'none',
									duration:1000,	
								})
								
								setTimeout(function() {		
									uni.navigateBack()
								}, 1000);
							}else{
								uni.showToast({
									title:res.data.message.message,
									icon:'none',
									duration:1000,	
								})
							}
						})
					}else{
						uni.showToast({
							title:res.data.message.message,
							icon:'none',
							duration:1000
						})
					}
				})
			}
			
		
		}
	}
</script>

<style lang="scss">
.gl{
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	padding: 20rpx 0 20rpx 20rpx;
}
.gl>text{
	font-size: 30rpx;
	font-weight: bold;
	padding-right: 60rpx;
}
.gl>input{
	font-size: 27rpx;
	color: #333;
	padding-top: 5rpx;
}

</style>
